```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Spring MVC 执行流程解析</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            @apply bg-gray-50 text-gray-800;
            line-height: 1.6;
        }
        h1, h2, h3, h4, h5, h6 {
            font-family: 'Noto Serif SC', serif;
            @apply font-bold;
        }
        .hero {
            background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
        }
        .card {
            @apply bg-white rounded-lg shadow-md overflow-hidden transition-all duration-300;
        }
        .card:hover {
            @apply shadow-lg transform -translate-y-1;
        }
        .code-block {
            @apply bg-gray-800 text-gray-100 p-4 rounded-md overflow-x-auto;
            font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
        }
        .step-number {
            @apply inline-flex items-center justify-center w-8 h-8 rounded-full bg-indigo-500 text-white font-bold mr-3;
        }
        .feature-icon {
            @apply text-indigo-500 text-2xl mb-3;
        }
        .active-nav {
            @apply bg-indigo-100 text-indigo-600;
        }
    </style>
</head>
<body class="min-h-screen">
    <!-- Hero Section -->
    <div class="hero text-white py-20 px-4 sm:px-6 lg:px-8">
        <div class="max-w-7xl mx-auto text-center">
            <div class="inline-block bg-indigo-600 bg-opacity-80 px-4 py-1 rounded-full text-sm font-medium mb-4 shadow-md">
                <i class="fas fa-code mr-2"></i>Spring Framework
            </div>
            <h1 class="text-4xl md:text-5xl lg:text-6xl font-extrabold mb-6 leading-tight">
                Spring MVC 执行流程解析
            </h1>
            <p class="text-xl md:text-2xl max-w-3xl mx-auto opacity-90 mb-10">
                深入探索 Spring MVC 的核心架构与请求处理机制
            </p>
            <div class="flex justify-center space-x-4">
                <a href="#overview" class="px-6 py-3 bg-white text-indigo-600 font-medium rounded-lg hover:bg-indigo-50 transition-colors shadow-md">
                    <i class="fas fa-play-circle mr-2"></i>开始探索
                </a>
                <a href="#diagram" class="px-6 py-3 bg-indigo-700 text-white font-medium rounded-lg hover:bg-indigo-600 transition-colors">
                    <i class="fas fa-project-diagram mr-2"></i>流程图解
                </a>
            </div>
        </div>
    </div>

    <!-- Main Content -->
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
        <div class="flex flex-col lg:flex-row gap-8">
            <!-- Navigation -->
            <div class="lg:w-1/4">
                <div class="card sticky top-8 p-6">
                    <h3 class="text-xl font-bold mb-4 text-indigo-600 border-b pb-2">
                        <i class="fas fa-list-ul mr-2"></i>内容导航
                    </h3>
                    <nav>
                        <ul class="space-y-2">
                            <li><a href="#overview" class="block px-3 py-2 rounded hover:bg-indigo-50 transition-colors active-nav"><i class="far fa-list-alt mr-2"></i>执行流程概述</a></li>
                            <li><a href="#request" class="block px-3 py-2 rounded hover:bg-indigo-50 transition-colors"><i class="fas fa-exchange-alt mr-2"></i>客户端请求</a></li>
                            <li><a href="#dispatcher" class="block px-3 py-2 rounded hover:bg-indigo-50 transition-colors"><i class="fas fa-tasks mr-2"></i>DispatcherServlet</a></li>
                            <li><a href="#handler-mapping" class="block px-3 py-2 rounded hover:bg-indigo-50 transition-colors"><i class="fas fa-map-marked-alt mr-2"></i>Handler Mapping</a></li>
                            <li><a href="#handler-adapter" class="block px-3 py-2 rounded hover:bg-indigo-50 transition-colors"><i class="fas fa-cogs mr-2"></i>Handler Adapter</a></li>
                            <li><a href="#model-view" class="block px-3 py-2 rounded hover:bg-indigo-50 transition-colors"><i class="fas fa-layer-group mr-2"></i>ModelAndView</a></li>
                            <li><a href="#view-resolver" class="block px-3 py-2 rounded hover:bg-indigo-50 transition-colors"><i class="fas fa-search mr-2"></i>视图解析</a></li>
                            <li><a href="#view-render" class="block px-3 py-2 rounded hover:bg-indigo-50 transition-colors"><i class="fas fa-paint-brush mr-2"></i>视图渲染</a></li>
                            <li><a href="#response" class="block px-3 py-2 rounded hover:bg-indigo-50 transition-colors"><i class="fas fa-reply mr-2"></i>响应返回</a></li>
                        </ul>
                    </nav>
                    <div class="mt-6 pt-4 border-t">
                        <h4 class="text-sm font-semibold text-gray-500 uppercase tracking-wider mb-3">快速链接</h4>
                        <div class="flex flex-wrap gap-2">
                            <a href="#" class="text-xs px-3 py-1 bg-gray-100 rounded-full hover:bg-gray-200 transition-colors"><i class="fas fa-book mr-1"></i>文档</a>
                            <a href="#" class="text-xs px-3 py-1 bg-gray-100 rounded-full hover:bg-gray-200 transition-colors"><i class="fas fa-code mr-1"></i>示例</a>
                            <a href="#" class="text-xs px-3 py-1 bg-gray-100 rounded-full hover:bg-gray-200 transition-colors"><i class="fas fa-question-circle mr-1"></i>FAQ</a>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Article Content -->
            <div class="lg:w-2/3">
                <!-- Overview Section -->
                <section id="overview" class="mb-16">
                    <div class="flex items-center mb-6">
                        <h2 class="text-3xl font-bold text-gray-900">
                            Spring MVC 执行流程概述
                        </h2>
                        <div class="ml-4 px-3 py-1 bg-indigo-100 text-indigo-800 rounded-full text-sm font-medium">
                            核心概念
                        </div>
                    </div>
                    
                    <div class="mb-8">
                        <p class="text-lg text-gray-700 mb-6">
                            Spring MVC 是 Spring Framework 的核心模块之一，提供了基于 Model-View-Controller（MVC）架构的 Web 应用开发框架。它将请求的处理与视图的渲染解耦，使得应用程序更易于测试和扩展。
                        </p>
                        <img src="https://cdn.nlark.com/yuque/0/2023/png/21449790/1689776219439-819f6bd7-111f-472d-9e99-82239e5f9349.png" alt="Spring MVC 架构图" class="w-full rounded-lg shadow-md border border-gray-200">
                    </div>

                    <div class="card p-6 mb-8">
                        <div class="flex items-center mb-4">
                            <i class="fas fa-sitemap feature-icon"></i>
                            <h3 class="text-xl font-bold ml-2">MVC 架构优势</h3>
                        </div>
                        <div class="grid md:grid-cols-3 gap-6">
                            <div class="p-4 border-l-4 border-indigo-300 bg-indigo-50 rounded-r">
                                <h4 class="font-bold mb-2">关注点分离</h4>
                                <p class="text-sm text-gray-700">业务逻辑、视图呈现和用户交互分离，提高代码组织性</p>
                            </div>
                            <div class="p-4 border-l-4 border-indigo-300 bg-indigo-50 rounded-r">
                                <h4 class="font-bold mb-2">易于测试</h4>
                                <p class="text-sm text-gray-700">各组件松耦合，可独立测试，提高测试覆盖率</p>
                            </div>
                            <div class="p-4 border-l-4 border-indigo-300 bg-indigo-50 rounded-r">
                                <h4 class="font-bold mb-2">灵活扩展</h4>
                                <p class="text-sm text-gray-700">可轻松替换视图技术或调整业务逻辑，不影响其他部分</p>
                            </div>
                        </div>
                    </div>

                    <div class="card p-6">
                        <h3 class="text-xl font-bold mb-4 flex items-center">
                            <i class="fas fa-project-diagram mr-2 text-indigo-500"></i>执行流程步骤
                        </h3>
                        <div class="space-y-4">
                            <div class="flex items-start">
                                <span class="step-number">1</span>
                                <div>
                                    <h4 class="font-bold">客户端请求</h4>
                                    <p class="text-sm text-gray-600">浏览器或其他HTTP客户端发起请求</p>
                                </div>
                            </div>
                            <div class="flex items-start">
                                <span class="step-number">2</span>
                                <div>
                                    <h4 class="font-bold">DispatcherServlet处理</h4>
                                    <p class="text-sm text-gray-600">前端控制器捕获并分发请求</p>
                                </div>
                            </div>
                            <div class="flex items-start">
                                <span class="step-number">3</span>
                                <div>
                                    <h4 class="font-bold">Handler Mapping</h4>
                                    <p class="text-sm text-gray-600">确定请求的处理器(Controller)</p>
                                </div>
                            </div>
                            <div class="flex items-start">
                                <span class="step-number">4</span>
                                <div>
                                    <h4 class="font-bold">Handler Adapter</h4>
                                    <p class="text-sm text-gray-600">执行找到的处理器方法</p>
                                </div>
                            </div>
                            <div class="flex items-start">
                                <span class="step-number">5</span>
                                <div>
                                    <h4 class="font-bold">处理器执行</h4>
                                    <p class="text-sm text-gray-600">返回ModelAndView对象</p>
                                </div>
                            </div>
                            <div class="flex items-start">
                                <span class="step-number">6</span>
                                <div>
                                    <h4 class="font-bold">视图解析</h4>
                                    <p class="text-sm text-gray-600">将逻辑视图名解析为具体视图</p>
                                </div>
                            </div>
                            <div class="flex items-start">
                                <span class="step-number">7</span>
                                <div>
                                    <h4 class="font-bold">视图渲染</h4>
                                    <p class="text-sm text-gray-600">将模型数据渲染为HTML</p>
                                </div>
                            </div>
                            <div class="flex items-start">
                                <span class="step-number">8</span>
                                <div>
                                    <h4 class="font-bold">响应返回</h4>
                                    <p class="text-sm text-gray-600">将最终响应返回给客户端</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>

                <!-- Diagram Section -->
                <section id="diagram" class="mb-16">
                    <div class="flex items-center mb-6">
                        <h2 class="text-3xl font-bold text-gray-900">
                            Spring MVC 流程图解
                        </h2>
                        <div class="ml-4 px-3 py-1 bg-indigo-100 text-indigo-800 rounded-full text-sm font-medium">
                            可视化
                        </div>
                    </div>
                    <div class="card p-6">
                        <div class="mermaid">
                            sequenceDiagram
                                participant Client as 客户端
                                participant DispatcherServlet as DispatcherServlet
                                participant HandlerMapping as HandlerMapping
                                participant HandlerAdapter as HandlerAdapter
                                participant Controller as Controller
                                participant ViewResolver as ViewResolver
                                participant View as View

                                Client->>DispatcherServlet: HTTP请求
                                DispatcherServlet->>HandlerMapping: 查询处理器
                                HandlerMapping-->>DispatcherServlet: 返回处理器
                                DispatcherServlet->>HandlerAdapter: 执行处理器
                                HandlerAdapter->>Controller: 调用方法
                                Controller-->>HandlerAdapter: 返回ModelAndView
                                HandlerAdapter-->>DispatcherServlet: 返回ModelAndView
                                DispatcherServlet->>ViewResolver: 解析视图
                                ViewResolver-->>DispatcherServlet: 返回视图
                                DispatcherServlet->>View: 渲染视图
                                View-->>DispatcherServlet: 返回渲染结果
                                DispatcherServlet-->>Client: HTTP响应
                        </div>
                    </div>
                </section>

                <!-- Detailed Steps -->
                <section>
                    <!-- 1. Client Request -->
                    <div id="request" class="card p-6 mb-8">
                        <div class="flex items-center mb-4">
                            <span class="step-number">1</span>
                            <h3 class="text-xl font-bold ml-3">客户端请求</h3>
                        </div>
                        <p class="text-gray-700 mb-4">
                            客户端请求通常是一个 HTTP 请求，由浏览器或其他 HTTP 客户端发起。请求可能是通过表单提交、AJAX 调用、链接点击等触发。
                        </p>
                        <div class="code-block mb-4">
                            <pre>GET /path HTTP/1.1
User-Agent: Mozilla/5.0
Accept: text/html,application/xhtml+xml</pre>
                        </div>
                        <div class="bg-blue-50 p-4 rounded-lg border-l-4 border-blue-400">
                            <h4 class="font-bold text-blue-800 mb-2">请求中的重要信息：</h4>
                            <ul class="list-disc pl-5 text-sm text-blue-700 space-y-1">
                                <li><strong>HTTP 方法</strong>：如 GET、POST、PUT、DELETE 等</li>
                                <li><strong>请求路径</strong>：用于识别所请求的资源</li>
                                <li><strong>请求参数</strong>：可以是查询参数或请求体中的数据</li>
                                <li><strong>请求头</strong>：包括内容类型、用户代理等元数据</li>
                            </ul>
                        </div>
                    </div>

                    <!-- 2. DispatcherServlet -->
                    <div id="dispatcher" class="card p-6 mb-8">
                        <div class="flex items-center mb-4">
                            <span class="step-number">2</span>
                            <h3 class="text-xl font-bold ml-3">请求到达 DispatcherServlet</h3>
                        </div>
                        <p class="text-gray-700 mb-4">
                            在 Spring MVC 中，<code class="bg-gray-100 px-1 rounded">DispatcherServlet</code> 是一个核心组件，作为前端控制器（Front Controller），它负责捕获和分发所有进入应用的请求。<code class="bg-gray-100 px-1 rounded">DispatcherServlet</code> 是一个 Servlet，必须在 <code class="bg-gray-100 px-1 rounded">web.xml</code> 文件中配置或通过 Java Config 注册。
                        </p>
                        <div class="code-block mb-4">
                            <pre>&lt;servlet&gt;
  &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
  &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
  &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
&lt;/servlet&gt;

&lt;servlet-mapping&gt;
  &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
  &lt;url-pattern&gt;/&lt;/url-pattern&gt;
&lt;/servlet-mapping&gt;</pre>
                        </div>
                        <div class="grid md:grid-cols-2 gap-4">
                            <div class="bg-indigo-50 p-4 rounded-lg">
                                <h4 class="font-bold text-indigo-800 mb-2 flex items-center">
                                    <i class="fas fa-tasks mr-2"></i>DispatcherServlet 的角色
                                </h4>
                                <ul class="list-disc pl-5 text-sm text-indigo-700 space-y-1">
                                    <li><strong>初始化</strong>：在应用启动时加载 Spring 的上下文</li>
                                    <li><strong>请求分发</strong>：将请求转发给适当的处理器</li>
                                    <li><strong>集成其他组件</strong>：如视图解析器、异常处理器等</li>
                                </ul>
                            </div>
                            <div class="bg-purple-50 p-4 rounded-lg">
                                <h4 class="font-bold text-purple-800 mb-2 flex items-center">
                                    <i class="fas fa-cog mr-2"></i>初始化流程：
                                </h4>
                                <ol class="list-decimal pl-5 text-sm text-purple-700 space-y-1">
                                    <li><strong>创建 WebApplicationContext</strong></li>
                                    <li><strong>加载配置文件</strong></li>
                                    <li><strong>初始化组件</strong></li>
                                </ol>
                            </div>
                        </div>
                    </div>

                    <!-- 3. Handler Mapping -->
                    <div id="handler-mapping" class="card p-6 mb-8">
                        <div class="flex items-center mb-4">
                            <span class="step-number">3</span>
                            <h3 class="text-xl font-bold ml-3">Handler Mapping 定位处理器</h3>
                        </div>
                        <p class="text-gray-700 mb-4">
                            <code class="bg-gray-100 px-1 rounded">DispatcherServlet</code> 使用 <code class="bg-gray-100 px-1 rounded">HandlerMapping</code> 来确定请求的合适处理器。<code class="bg-gray-100 px-1 rounded">HandlerMapping</code> 是一个接口，其实现类负责映射 URL 到具体的处理器（Controller）方法。
                        </p>
                        <div class="bg-yellow-50 p-4 rounded-lg border-l-4 border-yellow-400 mb-4">
                            <h4 class="font-bold text-yellow-800 mb-2">常见的 HandlerMapping 实现</h4>
                            <ul class="list-disc pl-5 text-sm text-yellow-700 space-y-1">
                                <li><strong>RequestMappingHandlerMapping</strong>：基于注解的映射，通过 <code class="bg-yellow-100 px-1 rounded">@RequestMapping</code> 定义 URL 到方法的映射关系</li>
                                <li><strong>SimpleUrlHandlerMapping</strong>：通过配置文件或 Java Config 定义静态的 URL 映射</li>
                                <li><strong>BeanNameUrlHandlerMapping</strong>：将请求映射到与请求 URL 名称匹配的 Bean</li>
                            </ul>
                        </div>
                        <h4 class="font-bold text-gray-800 mb-2 mt-6">RequestMappingHandlerMapping 的工作原理</h4>
                        <div class="grid md:grid-cols-3 gap-4 mb-4">
                            <div class="bg-white p-3 border rounded-lg">
                                <div class="text-center text-blue-500 mb-2"><i class="fas fa-search fa-2x"></i></div>
                                <h5 class="font-semibold text-center">扫描 Controller</h5>
                                <p class="text-xs text-center text-gray-600">扫描所有带有 @Controller 注解的类</p>
                            </div>
                            <div class="bg-white p-3 border rounded-lg">
                                <div class="text-center text-green-500 mb-2"><i class="fas fa-code fa-2x"></i></div>
                                <h5 class="font-semibold text-center">解析注解</h5>
                                <p class="text-xs text-center text-gray-600">解析类和方法上的 @RequestMapping 注解</p>
                            </div>
                            <div class="bg-white p-3 border rounded-lg">
                                <div class="text-center text-purple-500 mb-2"><i class="fas fa-link fa-2x"></i></div>
                                <h5 class="font-semibold text-center">匹配请求</h5>
                                <p class="text-xs text-center text-gray-600">根据请求信息匹配适当的处理器方法</p>
                            </div>
                        </div>
                        <div class="code-block mb-4">
                            <pre>@Controller
public class HelloController {

    @RequestMapping(value = "/greet", method = RequestMethod.GET)
    public String greet(Model model) {
        model.addAttribute("message", "Hello, World!");
        return "greetView";
    }
}</pre>
                        </div>
                        <div class="bg-blue-50 p-4 rounded-lg">
                            <h4 class="font-bold text-blue-800 mb-2">请求匹配</h4>
                            <ul class="list-disc pl-5 text-sm text-blue-700 space-y-1">
                                <li><strong>URL 匹配</strong>：<code class="bg-blue-100 px-1 rounded">/greet</code></li>
                                <li><strong>HTTP 方法</strong>：GET</li>
                                <li><strong>请求参数</strong>：通过 <code class="bg-blue-100 px-1 rounded">@RequestParam</code> 解析查询参数</li>
                            </ul>
                        </div>
                    </div>

                    <!-- 4. Handler Adapter -->
                    <div id="handler-adapter" class="card p-6 mb-8">
                        <div class="flex items-center mb-4">
                            <span class="step-number">4</span>
                            <h3 class="text-xl font-bold ml-3">Handler Adapter 调用处理器</h3>
                        </div>
                        <p class="text-gray-700 mb-4">
                            一旦找到合适的处理器（Controller），<code class="bg-gray-100 px-1 rounded">DispatcherServlet</code> 使用 <code class="bg-gray-100 px-1 rounded">HandlerAdapter</code> 来执行处理器方法。<code class="bg-gray-100 px-1 rounded">HandlerAdapter</code> 是一个接口，其实现类负责适配不同类型的处理器方法。
                        </p>
                        <div class="bg-green-50 p-4 rounded-lg border-l-4 border-green-400 mb-4">
                            <h4 class="font-bold text-green-800 mb-2">常见的 HandlerAdapter 实现</h4>
                            <ul class="list-disc pl-5 text-sm text-green-700 space-y-1">
                                <li><strong>RequestMappingHandlerAdapter</strong>：处理使用 <code class="bg-green-100 px-1 rounded">@RequestMapping</code> 注解的方法</li>
                                <li><strong>HttpRequestHandlerAdapter</strong>：处理实现 <code class="bg-green-100 px-1 rounded">HttpRequestHandler</code> 接口的 Bean</li>
                                <li><strong>SimpleControllerHandlerAdapter</strong>：处理实现 <code class="bg-green-100 px-1 rounded">Controller</code> 接口的 Bean</li>
                            </ul>
                        </div>
                        <h4 class="font-bold text-gray-800 mb-2 mt-6">RequestMappingHandlerAdapter 的执行流程</h4>
                        <div class="grid md:grid-cols-3 gap-4 mb-4">
                            <div class="bg-white p-3 border rounded-lg">
                                <div class="text-center text-blue-500 mb-2"><i class="fas fa-database fa-2x"></i></div>
                                <h5 class="font-semibold text-center">数据绑定</h5>
                                <p class="text-xs text-center text-gray-600">将请求参数绑定到方法参数</p>
                            </div>
                            <div class="bg-white p-3 border rounded-lg">
                                <div class="text-center text-purple-500 mb-2"><i class="fas fa-play fa-2x"></i></div>
                                <h5 class="font-semibold text-center">方法执行</h5>
                                <p class="text-xs text-center text-gray-600">调用处理器方法</p>
                            </div>
                            <div class="bg-white p-3 border rounded-lg">
                                <div class="text-center text-indigo-500 mb-2"><i class="fas fa-arrow-right fa-2x"></i></div>
                                <h5 class="font-semibold text-center">返回值处理</h5>
                                <p class="text-xs text-center text-gray-600">转换为 ModelAndView 或其他结果</p>
                            </div>
                        </div>
                        <div class="code-block mb-4">
                            <pre>public class HelloController {

    @RequestMapping(value = "/greet", method = RequestMethod.GET)
    public String greet(@RequestParam("name") String name, Model model) {
        model.addAttribute("message", "Hello, " + name + "!");
        return "greetView";
    }
}</pre>
                        </div>
                        <div class="grid md:grid-cols-2 gap-4">
                            <div class="bg-purple-50 p-4 rounded-lg">
                                <h4 class="font-bold text-purple-800 mb-2">数据绑定</h4>
                                <ul class="list-disc pl-5 text-sm text-purple-700 space-y-1">
                                    <li><strong>路径变量</strong>：通过 <code class="bg-purple-100 px-1 rounded">@PathVariable</code> 注解解析 URL 中的路径变量</li>
                                    <li><strong>请求参数</strong>：通过 <code class="bg-purple-100 px-1 rounded">@RequestParam</code> 注解解析查询参数</li>
                                    <li><strong>请求体</strong>：通过 <code class="bg-purple-100 px-1 rounded">@RequestBody</code> 注解解析请求体中的 JSON/XML 数据</li>
                                </ul>
                            </div>
                            <div class="bg-blue-50 p-4 rounded-lg">
                                <h4 class="font-bold text-blue-800 mb-2">返回值处理：</h4>
                                <ul class="list-disc pl-5 text-sm text-blue-700 space-y-1">
                                    <li><strong>视图名</strong>：返回逻辑视图名，由视图解析器解析</li>
                                    <li><strong>ModelAndView</strong>：返回包含模型和视图信息的对象</li>
                                    <li><strong>HttpEntity</strong>：返回包含响应头和内容的对象</li>
                                </ul>
                            </div>
                        </div>
                    </div>

                    <!-- 5. ModelAndView -->
                    <div id="model-view" class="card p-6 mb-8">
                        <div class="flex items-center mb-4">
                            <span class="step-number">5</span>
                            <h3 class="text-xl font-bold ml-3">处理器执行并返回 ModelAndView</h3>
                        </div>
                        <p class="text-gray-700 mb-4">
                            处理器方法执行后，返回 <code class="bg-gray-100 px-1 rounded">ModelAndView</code> 对象或其他结果。<code class="bg-gray-100 px-1 rounded">ModelAndView</code> 包含视图信息和模型数据，用于在视图中渲染。
                        </p>
                        <div class="bg-indigo-50 p-4 rounded-lg mb-4">
                            <h4 class="font-bold text-indigo-800 mb-2">ModelAndView 的结构</h4>
                            <ul class="list-disc pl-5 text-sm text-indigo-700 space-y-1">
                                <li><strong>视图名</strong>：逻辑视图名，将由视图解析器解析为具体视图</li>
                                <li><strong>模型数据</strong>：包含视图渲染所需的数据，通常是一个 <code class="bg-indigo-100 px-1 rounded">Map</code></li>
                            </ul>
                        </div>
                        <div class="code-block mb-4">
                            <pre>public class HelloController {

    @RequestMapping(value = "/greet", method = RequestMethod.GET)
    public ModelAndView greet(@RequestParam("name") String name) {
        ModelAndView modelAndView = new ModelAndView("greetView");
        modelAndView.addObject("message", "Hello, " + name + "!");
        return modelAndView;
    }
}</pre>
                        </div>
                        <div class="bg-gray-100 p-4 rounded-lg">
                            <h4 class="font-bold text-gray-800 mb-2">返回值类型</h4>
                            <div class="grid md:grid-cols-2 gap-4">
                                <div>
                                    <div class="flex items-start mb-2">
                                        <div class="bg-blue-100 text-blue-800 px-2 py-1 rounded text-xs font-mono mr-2">String</div>
                                        <span class="text-sm">表示视图名</span>
                                    </div>
                                    <div class="flex items-start mb-2">
                                        <div class="bg-green-100 text-green-800 px-2 py-1 rounded text-xs font-mono mr-2">ModelAndView</div>
                                        <span class="text-sm">包含视图和模型信息</span>
                                    </div>
                                </div>
                                <div>
                                    <div class="flex items-start mb-2">
                                        <div class="bg-purple-100 text-purple-800 px-2 py-1 rounded text-xs font-mono mr-2">ResponseEntity</div>
                                        <span class="text-sm">表示完整的 HTTP 响应</span>
                                    </div>
                                    <div class="flex items-start">
                                        <div class="bg-yellow-100 text-yellow-800 px-2 py-1 rounded text-xs font-mono mr-2">void</div>
                                        <span class="text-sm">通过直接写入响应体实现</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- 6. View Resolver -->
                    <div id="view-resolver" class="card p-6 mb-8">
                        <div class="flex items-center mb-4">
                            <span class="step-number">6</span>
                            <h3 class="text-xl font-bold ml-3">视图解析</h3>
                        </div>
                        <p class="text-gray-700 mb-4">
                            在得到 <code class="bg-gray-100 px-1 rounded">ModelAndView</code> 对象后，<code class="bg-gray-100 px-1 rounded">DispatcherServlet</code> 使用 <code class="bg-gray-100 px-1 rounded">ViewResolver</code> 将逻辑视图名解析为具体的视图对象。<code class="bg-gray-100 px-1 rounded">ViewResolver</code> 是一个接口，其实现类负责解析视图名并返回视图对象。
                        </p>
                        <div class="bg-purple-50 p-4 rounded-lg border-l-4 border-purple-400 mb-4">
                            <h4 class="font-bold text-purple-800 mb-2">常见的 ViewResolver 实现：</h4>
                            <ul class="list-disc pl-5 text-sm text-purple-700 space-y-1">
                                <li><strong>InternalResourceViewResolver</strong>：解析 JSP 视图，通过 <code class="bg-purple-100 px-1 rounded">RequestDispatcher</code> 转发</li>
                                <li><strong>ThymeleafViewResolver</strong>：解析 Thymeleaf 模板视图</li>
                                <li><strong>FreeMarkerViewResolver</strong>：解析 FreeMarker 模板视图</li>
                                <li><strong>VelocityViewResolver</strong>：解析 Velocity 模板视图</li>
                            </ul>
                        </div>
                        <h4 class="font-bold text-gray-800 mb-2 mt-6">InternalResourceViewResolver 的工作原理：</h4>
                        <div class="grid md:grid-cols-3 gap-4 mb-4">
                            <div class="bg-white p-3 border rounded-lg">
                                <div class="text-center text-blue-500 mb-2"><i class="fas fa-search fa-2x"></i></div>
                                <h5 class="font-semibold text-center">解析视图名</h5>
                                <p class="text-xs text-center text-gray-600">将逻辑视图名解析为 JSP 文件路径</p>
                            </div>
                            <div class="bg-white p-3 border rounded-lg">
                                <div class="text-center text-green-500 mb-2"><i class="fas fa-plus fa-2x"></i></div>
                                <h5 class="font-semibold text-center">创建视图对象</h5>
                                <p class="text-xs text-center text-gray-600">创建 InternalResourceView 对象</p>
                            </div>
                            <div class="bg-white p-3 border rounded-lg">
                                <div class="text-center text-purple-500 mb-2"><i class="fas fa-arrow-right fa-2x"></i></div>
                                <h5 class="font-semibold text-center">返回视图对象</h5>
                                <p class="text-xs text-center text-gray-600">将视图对象返回给 DispatcherServlet</p>
                            </div>
                        </div>
                        <div class="code-block mb-4">
                            <pre>@Bean
public InternalResourceViewResolver viewResolver() {
    InternalResourceViewResolver resolver = new InternalResourceViewResolver();
    resolver.setPrefix("/WEB-INF/views/");
    resolver.setSuffix(".jsp");
    return resolver;
}</pre>
                        </div>
                        <div class="bg-blue-50 p-4 rounded-lg">
                            <h4 class="font-bold text-blue-800 mb-2">视图解析流程</h4>
                            <ul class="list-disc pl-5 text-sm text-blue-700 space-y-1">
                                <li><strong>逻辑视图名</strong>：<code class="bg-blue-100 px-1 rounded">greetView</code></li>
                                <li><strong>物理视图路径</strong>：<code class="bg-blue-100 px-1 rounded">/WEB-INF/views/greetView.jsp</code></li>
                                <li><strong>视图对象</strong>：<code class="bg-blue-100 px-1 rounded">InternalResourceView</code></li>
                            </ul>
                        </div>
                    </div>

                    <!-- 7. View Render -->
                    <div id="view-render" class="card p-6 mb-8">
                        <div class="flex items-center mb-4">
                            <span class="step-number">7</span>
                            <h3 class="text-xl font-bold ml-3">视图渲染</h3>
                        </div>
                        <p class="text-gray-700 mb-4">
                            <code class="bg-gray-100 px-1 rounded">DispatcherServlet</code> 将模型数据传递给视图对象，视图对象负责将数据渲染为最终的 HTML 页面或其他响应格式。
                        </p>
                        <h4 class="font-bold text-gray-800 mb-2 mt-6">视图渲染的步骤</h4>
                        <div class="grid md:grid-cols-3 gap-4 mb-4">
                            <div class="bg-white p-3 border rounded-lg">
                                <div class="text-center text-blue-500 mb-2"><i class="fas fa-database fa-2x"></i></div>
                                <h5 class="font-semibold text-center">获取模型数据</h5>
                                <p class="text-xs text-center text-gray-600">从 ModelAndView 中获取</p>
                            </div>
                            <div class="bg-white p-3 border rounded-lg">
                                <div class="text-center text-green-500 mb-2"><i class="fas fa-paint-brush fa-2x"></i></div>
                                <h5 class="font-semibold text-center">渲染视图</h5>
                                <p class="text-xs text-center text-gray-600">填充数据到视图模板</p>
                            </div>
                            <div class="bg-white p-3 border rounded-lg">
                                <div class="text-center text-purple-500 mb-2"><i class="fas fa-file-export fa-2x"></i></div>
                                <h5 class="font-semibold text-center">写入响应</h5>
                                <p class="text-xs text-center text-gray-600">将内容写入 HTTP 响应</p>
                            </div>
                        </div>
                        <h4 class="font-bold text-gray-800 mb-2 mt-6">JSP 视图渲染示例</h4>
                        <div class="code-block mb-4">
                            <pre>&lt;%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Greeting&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;h1&gt;${message}&lt;/h1&gt;
  &lt;/body&gt;
&lt;/html&gt;</pre>
                        </div>
                        <div class="bg-yellow-50 p-4 rounded-lg">
                            <ul class="list-disc pl-5 text-sm text-yellow-700 space-y-1">
                                <li><strong>表达式语言（EL）</strong>：用来从模型中提取数据并展示</li>
                                <li><strong>JSTL 标签库</strong>：提供更丰富的标签，用于动态生成内容</li>
                            </ul>
                        </div>
                    </div>

                    <!-- 8. Response -->
                    <div id="response" class="card p-6">
                        <div class="flex items-center mb-4">
                            <span class="step-number">8</span>
                            <h3 class="text-xl font-bold ml-3">响应返回客户端</h3>
                        </div>
                        <p class="text-gray-700 mb-4">
                            最终，<code class="bg-gray-100 px-1 rounded">DispatcherServlet</code> 将渲染后的视图内容作为 HTTP 响应返回给客户端。客户端接收到响应后，将其呈现在浏览器中。
                        </p>
                        <div class="bg-green-50 p-4 rounded-lg mb-4">
                            <h4 class="font-bold text-green-800 mb-2">响应内容</h4>
                            <ul class="list-disc pl-5 text-sm text-green-700 space-y-1">
                                <li><strong>HTML 页面</strong>：通常是动态生成的 HTML 页面</li>
                                <li><strong>JSON/XML 数据</strong>：如果使用了 <code class="bg-green-100 px-1 rounded">ResponseBody</code> 注解，响应体将包含 JSON 或 XML 数据</li>
                                <li><strong>其他媒体类型</strong>：如文件下载、图片等</li>
                            </ul>
                        </div>
                        <h4 class="font-bold text-gray-800 mb-2 mt-6">HTTP 响应示例</h4>
                        <div class="code-block">
                            <pre>Content-Type: text/html; charset=UTF-8
Content-Length: 1234
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Greeting&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;h1&gt;Hello, World!&lt;/h1&gt;
  &lt;/body&gt;
&lt;/html&gt;</pre>
                        </div>
                    </div>
                </section>
            </div>
        </div>
    </div>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-8 px-4 sm:px-6 lg:px-8">
        <div class="max-w-7xl mx-auto">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-xl font-bold text-white">技术小馆</h3>
                    <p class="text-sm mt-1">深入探索技术原理与实践</p>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="text-indigo-400 hover:text-white transition-colors">
                        <i class="fas fa-external-link-alt mr-2"></i>www.yuque.com/jtostring
                    </a>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-6 pt-6 text-sm text-center text-gray-500">
                &copy; 2023 技术小馆. 保留所有权利.
            </div>
        </div>
    </footer>

    <script>
        // Initialize Mermaid
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: false,
                htmlLabels: true,
                curve: 'basis'
            }
        });

        // Smooth scrolling for anchor links
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
                
                // Update active nav item
                document.querySelectorAll('nav a').forEach(link => {
                    link.classList.remove('active-nav');
                });
                this.classList.add('active-nav');
            });
        });
    </script>
</body>
</html>
```